<?php 
class db_logs_model extends CI_Model {

    function __construct()
    {
        parent::__construct();
    }
    
    //-------------------------------------------------------------------------
    //---------------------------- FOR ITEM TABLE -----------------------------
    //-------------------------------------------------------------------------
    
    function translog_init($aParams=null){
        $query=$this->db->insert(PREFIX.'translog',$aParams); 
        //echo $this->db->last_query();exit;
        $count 	= $this->db->affected_rows();		
        if($count==1) return true;
        return false;
    }
    
    // update trans info
    function insert_onduplicate_translog_update($aParamsi,$aUpdate){
        $this->db->on_duplicate_update(PREFIX.'translog', $aUpdate, $aParamsi); 
                //echo $this->db->last_query();
        $count 	= $this->db->affected_rows();		
        if($count>0) return true;
        return false;
    }
    
    function getLogs($Params=array()){
         $query = $this->db->select('transID,itemName,itemType,gid,sid,username1,username2,character_name,initTime,confirmTime,finishTime,transCode,step,itemAmount,action,statusDesc,image')
                            ->where($Params)
                            ->from(PREFIX."translog")
                            //->order_by("created", "desc")
                            ->get();
         return $query->result();
    }
    function getItembySqlStr($str=''){
        if($str!=''){
            $query = $this->db->select('transID,itemName,itemType,gid,sid,username1,username2,character_name,initTime,confirmTime,finishTime,transCode,step,itemAmount,action,statusDesc,image')
                                ->where($str)
                                ->from(PREFIX."translog")
                                //->order_by("created", "desc")
                                ->get();
            return $query->result();
        }
        return 0;
    }
}
?>
